<template>
	<view>
		<view class='bg-red light padding'>
		  <view>
		    亲，您的入驻申请已通过审核。请继续支付入驻费用，成功后将展示在商家列表中。
		  </view>
		</view>
		<view class="cu-form-group">
		  <view class="title text-gray"><text class='text-red'>*</text>入驻费用</view>
		</view>
		<radio-group class="block" @change="radioChange">
		  <view class="cu-form-group" v-for="item in noteList" >
		    <view class="title">
		      <text class="text-red">￥ item.paycheckNum </text>/ item.paycheckDesc 
		      <text class="padding-left-xs text-red line-through" v-if="item.specialNote"> item.specialNote </text>
		    </view>
		    <radio class="checked" :value="index" :checked="payIndex==index"></radio>
		  </view>
		</radio-group>
		<button class="cu-btn block bg-blue margin-tb-sm lg margin" @tap="pay">
		  立即支付
		</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				  noteList: [],
				    payIndex: 0,
				    showModal: false
			}
		},
		onLoad(options) {
			 
		},
		onShow() {

		},
		methods: {
			
			pay(){
				let type = '0';  //0-手机自带浏览器H5支付， 2-原生安卓App支付
				var ua = window.navigator.userAgent.toLowerCase();
				if (ua.match(/micromessenger/i) == 'micromessenger') {  
					type = '1';//1-微信里打开H5支付
				}
				let data = {
					paycheckNum: this.curPay.paycheckNum,
					paycheckId: this.curPay.paycheckId,
					type: type,
					orderType: 3, //车队入驻
				};
				let _this = this;
				var timestamp = Date.parse(new Date());
				this.baseRequest('api/driver/recharge/gold', 'POST', data, function(res, info) {
					var ua = window.navigator.userAgent.toLowerCase();
					if (ua.match(/micromessenger/i) == 'micromessenger') {  
						// 支付
						_this.$wx.wxpay(res, function(r) { 
							if(r.errMsg == 'chooseWXPay:ok'){
								uni.showLoading({
									title: '请稍候'
								})
								setTimeout(()=>{
									window.location.href = res.mweb_url + '&time='+timestamp;
								}, 1000)
								/*
								uni.redirectTo({
									//支付成功转到支付成功提示页面  
									url: '/pages/user/payres'
								})  
								*/
							}else{
								
							}
						});
					} else {  
					    uni.showLoading({
					    	title: '请稍候'
					    })
					    setTimeout(()=>{
							uni.hideLoading();
					    	window.location.href = res.mweb_url + '&time='+timestamp;
					    }, 1000)
					}  
				});
			}
			
		}
	}
</script>

<style>

</style>
